#ifndef CREDENZA_ICON_INFO_H
#define CREDENZA_ICON_INFO_H

#include <glib-object.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdk.h>
#include <gio/gio.h>
#include <gtk/gtk.h>

G_BEGIN_DECLS

/* Names for Credenza's different zoom levels, from tiniest items to largest items */
typedef enum {
	CREDENZA_ZOOM_LEVEL_SMALLEST,
	CREDENZA_ZOOM_LEVEL_SMALLER,
	CREDENZA_ZOOM_LEVEL_SMALL,
	CREDENZA_ZOOM_LEVEL_OLDSMALL,
	CREDENZA_ZOOM_LEVEL_STANDARD,
	CREDENZA_ZOOM_LEVEL_LARGE,
	CREDENZA_ZOOM_LEVEL_LARGER,
	CREDENZA_ZOOM_LEVEL_LARGEST
} CredenzaZoomLevel;

#define CREDENZA_ZOOM_LEVEL_N_ENTRIES (CREDENZA_ZOOM_LEVEL_LARGEST + 1)

/* Nominal icon sizes for each Credenza zoom level.
 * This scheme assumes that icons are designed to
 * fit in a square space, though each image needn't
 * be square. Since individual icons can be stretched,
 * each icon is not constrained to this nominal size.
 */
#define CREDENZA_ICON_SIZE_SMALLEST	16
#define CREDENZA_ICON_SIZE_SMALLER	24
#define CREDENZA_ICON_SIZE_SMALL	32
#define CREDENZA_ICON_SIZE_OLDSMALL	36
#define CREDENZA_ICON_SIZE_STANDARD	48
#define CREDENZA_ICON_SIZE_LARGE	72
#define CREDENZA_ICON_SIZE_LARGER	96
#define CREDENZA_ICON_SIZE_LARGEST     192

/* Maximum size of an icon that the icon factory will ever produce */
#define CREDENZA_ICON_MAXIMUM_SIZE     320

typedef struct _CredenzaIconInfo      CredenzaIconInfo;
typedef struct _CredenzaIconInfoClass CredenzaIconInfoClass;


#define CREDENZA_TYPE_ICON_INFO                 (credenza_icon_info_get_type ())
#define CREDENZA_ICON_INFO(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), CREDENZA_TYPE_ICON_INFO, CredenzaIconInfo))
#define CREDENZA_ICON_INFO_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), CREDENZA_TYPE_ICON_INFO, CredenzaIconInfoClass))
#define CREDENZA_IS_ICON_INFO(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CREDENZA_TYPE_ICON_INFO))
#define CREDENZA_IS_ICON_INFO_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), CREDENZA_TYPE_ICON_INFO))
#define CREDENZA_ICON_INFO_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), CREDENZA_TYPE_ICON_INFO, CredenzaIconInfoClass))


GType    credenza_icon_info_get_type (void) G_GNUC_CONST;

CredenzaIconInfo *    credenza_icon_info_new_for_pixbuf               (GdkPixbuf         *pixbuf);
CredenzaIconInfo *    credenza_icon_info_lookup                       (GIcon             *icon,
								       int                size);
CredenzaIconInfo *    credenza_icon_info_lookup_from_name             (const char        *name,
								       int                size);
CredenzaIconInfo *    credenza_icon_info_lookup_from_path             (const char        *path,
								       int                size);
gboolean              credenza_icon_info_is_fallback                  (CredenzaIconInfo  *icon);
GdkPixbuf *           credenza_icon_info_get_pixbuf                   (CredenzaIconInfo  *icon);
GdkPixbuf *           credenza_icon_info_get_pixbuf_nodefault         (CredenzaIconInfo  *icon);
GdkPixbuf *           credenza_icon_info_get_pixbuf_nodefault_at_size (CredenzaIconInfo  *icon,
								       gsize              forced_size);
GdkPixbuf *           credenza_icon_info_get_pixbuf_at_size           (CredenzaIconInfo  *icon,
								       gsize              forced_size);
gboolean              credenza_icon_info_get_embedded_rect            (CredenzaIconInfo  *icon,
								       GdkRectangle      *rectangle);
gboolean              credenza_icon_info_get_attach_points            (CredenzaIconInfo  *icon,
								       GdkPoint         **points,
								       gint              *n_points);
G_CONST_RETURN char  *credenza_icon_info_get_display_name             (CredenzaIconInfo  *icon);
G_CONST_RETURN char  *credenza_icon_info_get_used_name                (CredenzaIconInfo  *icon);

void                  credenza_icon_info_clear_caches                 (void);

/* Relationship between zoom levels and icons sizes. */
guint credenza_get_icon_size_for_zoom_level          (CredenzaZoomLevel  zoom_level);
float credenza_get_relative_icon_size_for_zoom_level (CredenzaZoomLevel  zoom_level);

guint credenza_icon_get_larger_icon_size             (guint              size);
guint credenza_icon_get_smaller_icon_size            (guint              size);

gint  credenza_get_icon_size_for_stock_size          (GtkIconSize        size);
guint credenza_icon_get_emblem_size_for_icon_size    (guint              size);


G_END_DECLS

#endif /* CREDENZA_ICON_INFO_H */

